package com.hmall.order.web;


import com.hmall.common.client.ClientFeign;
import com.hmall.order.pojo.Order;
import com.hmall.order.pojo.RequestParams;
import com.hmall.order.service.IOrderService;
import feign.Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrderController {

   @Autowired
   private IOrderService orderService;




   /**
    * 根据id查询订单表
    * @param orderId
    * @return
    */
   @GetMapping("/{id}")
   public Order queryOrderById(@PathVariable("id") Long orderId) {
      return orderService.getById(orderId);
   }


   /**
    * 创建订单
    * @param params
    * @return
    */
   @PostMapping
   public Long placeOrder(@RequestBody RequestParams params){
      return orderService.placeOrder(params);
   }






}
